import type { Key } from './types'
import type { Menu } from '@/router/types'

import { propTypes } from '@/utils/propTypes'

export const basicProps = {
  items: {
    type: Array as PropType<Menu[]>,
    default: () => [],
  },
  // 最好是4 倍数
  inlineIndent: propTypes.number.def(20),
  inlineCollapsed: propTypes.bool,
  mixSider: propTypes.bool,

  isHorizontal: propTypes.bool,
  accordion: propTypes.bool.def(true),
  beforeClickFn: {
    type: Function as PropType<(key: Key) => Promise<boolean>>,
  },
}

export const itemProps = {
  item: {
    type: Object as PropType<Menu>,
    default: () => ({}),
  },
  level: propTypes.number,
  showTitle: propTypes.bool,
  isHorizontal: propTypes.bool,
}

export const contentProps = {
  item: {
    type: Object as PropType<Menu>,
    default: null,
  },
  showTitle: propTypes.bool.def(true),
  level: propTypes.number.def(0),
  isHorizontal: propTypes.bool.def(true),
}
